﻿using System.ComponentModel;
using Gwn.Library.MvpVm.Interfaces;

namespace Gwn.Library.MvpVm.Base
{
    /// <summary>
    /// ViewModel baseclass
    /// </summary>
    public class ViewModelBase : IViewModel, INotifyPropertyChanged
    {
        /// <summary>
        /// Occurs when a property value changes.
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// Called when [property changed].
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        public void OnPropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
